
<div class="span12">
    <div class="box box-color box-bordered">
        <div class="box-title">
            <h3>
                <i class="icon-table"></i>
                Precios
            </h3>
            <div class="actions">
                <?php if (myCapability::testcap($caps, myCapability::C('CAP_M_ADMIN_ORDER'))) { ?>
                    <a href="#mdlOrder" role="button" class="btn" data-toggle="modal"><i class="icon-table"></i></a>
                <?php } ?>
                <?php if (myCapability::testcap($caps, myCapability::C('CAP_M_ADMIN_FILTER'))) { ?>
                    <!--a href="#mdlFilter" role="button" class="btn" data-toggle="modal"><i class="icon-search"></i></a-->
                <?php } ?>
                <?php if (myCapability::testcap($caps, myCapability::C('CAP_M_ADMIN_EXCEL'))) { ?>
                    <a href="<?php echo url_for('/prices/excelPrices'); ?>" role="button" class="btn" ><i class="icon-download-alt"></i></a>
                <?php } ?>
                <ul class="nav nav-pills">
                    <li class='dropdown'>
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Seleccione Locales<span class="caret"></span></a>
                        <ul class="dropdown-menu  pull-right" style="height: 100px;overflow: auto;">
                            <?php
                            //
                            foreach ($stores as $value) {
                                ?>
                                <li><a href="<?php echo url_for('information/index'); ?>?id=<?php echo $value['id_store']; ?>"><?php echo $value['name']; ?></a></li>

                            <?php } ?>
                        </ul>
                    </li>
                </ul>

            </div>
        </div>
        <div class="box-content nopadding">
<div class="row-fluid">
                            <div class="span12">
            <?php
            //echo $userOrderCount;die();

            if ($userOrderCount != 0) {
                ?>
                <table class="table table-bordered dataTable dataTable-scroll-x">
                    <thead>
                        <tr>
                            <?php foreach ($userTableOrder as $value) { ?>


                                <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 37 && $value['UserTableOrder'][0]['visible'] == 1) { ?><th>Producto</th><?php } ?>
                                <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 38 && $value['UserTableOrder'][0]['visible'] == 1) { ?><th>Precio</th><?php } ?>
                                <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 39 && $value['UserTableOrder'][0]['visible'] == 1) { ?><th>Código Proveedor</th><?php } ?>
                                <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 40 && $value['UserTableOrder'][0]['visible'] == 1) { ?><th>Categoría</th><?php } ?>
                                <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 41 && $value['UserTableOrder'][0]['visible'] == 1) { ?><th>Marca</th><?php } ?>
                                <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 42 && $value['UserTableOrder'][0]['visible'] == 1) { ?><th>Únidades</th><?php } ?>
                                <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 43 && $value['UserTableOrder'][0]['visible'] == 1) { ?><th>Precio Sugerido</th><?php } ?>
                                <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 44 && $value['UserTableOrder'][0]['visible'] == 1) { ?><th>Precio Hoy</th><?php } ?>
                                <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 45 && $value['UserTableOrder'][0]['visible'] == 1) { ?><th>Precio Semanal</th><?php } ?>
                                <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 46 && $value['UserTableOrder'][0]['visible'] == 1) { ?><th>Diferencia</th><?php } ?>
                                <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 47 && $value['UserTableOrder'][0]['visible'] == 1) { ?><th>Precio Semana 1</th><?php } ?>
                                <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 48 && $value['UserTableOrder'][0]['visible'] == 1) { ?><th>Promedio Semanal</th><?php } ?>
                                <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 49 && $value['UserTableOrder'][0]['visible'] == 1) { ?><th>Máximo</th><?php } ?>
                                <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 50 && $value['UserTableOrder'][0]['visible'] == 1) { ?><th>Mínimo</th><?php } ?>
                                <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 51 && $value['UserTableOrder'][0]['visible'] == 1) { ?><th>Desviación</th><?php } ?>
                                <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 52 && $value['UserTableOrder'][0]['visible'] == 1) { ?><th>Competidores</th><?php } ?>


                            <?php } ?>
                        </tr>
                    </thead>
                    <tbody>

                        <?php
                        $dataArray = array();
                        $i = 0;
                        foreach ($prices as $value) {

                            $dataArray[$i][]['producto'] = $value['name'];
                            $dataArray[$i][]['precio'] = $value['name'];
                            $dataArray[$i][]['codProveedor'] = $value['name'];
                            $dataArray[$i][]['categoria'] = $value['name'];
                            $dataArray[$i][]['marca'] = $value['name'];
                            $dataArray[$i][]['unidades'] = $value['name'];
                            $dataArray[$i][]['pSugerido'] = $value['name'];
                            $dataArray[$i][]['pHoy'] = $value['name'];
                            $dataArray[$i][]['pSemanal'] = $value['name'];
                            $dataArray[$i][]['diferencia'] = $value['name'];
                            $dataArray[$i][]['pSemana1'] = $value['name'];
                            $dataArray[$i][]['promedioS'] = $value['name'];
                            $dataArray[$i][]['maximo'] = $value['name'];
                            $dataArray[$i][]['minimo'] = $value['name'];
                            $dataArray[$i][]['desviacion'] = $value['name'];
                            $dataArray[$i][]['competidores'] = $value['name'];
                            $i++;
                        }


                        for ($x = 0; $x < $i; $x++) {
                            ?>
                            <tr>

                                <?php foreach ($userTableOrder as $value) { ?>
                                    <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 37 && $value['UserTableOrder'][0]['visible'] == 1) { ?><td><?php echo $dataArray[$x][0]['producto']; ?></td><?php } ?>
                                    <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 38 && $value['UserTableOrder'][0]['visible'] == 1) { ?><td><?php echo $dataArray[$x][1]['precio']; ?></td><?php } ?>
                                    <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 39 && $value['UserTableOrder'][0]['visible'] == 1) { ?><td><?php echo $dataArray[$x][2]['codProveedor']; ?></td><?php } ?>
                                    <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 40 && $value['UserTableOrder'][0]['visible'] == 1) { ?><td><?php echo $dataArray[$x][3]['categoria']; ?></td><?php } ?>
                                    <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 41 && $value['UserTableOrder'][0]['visible'] == 1) { ?><td><?php echo $dataArray[$x][4]['marca']; ?></td><?php } ?>
                                    <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 42 && $value['UserTableOrder'][0]['visible'] == 1) { ?><td><?php echo $dataArray[$x][5]['unidades']; ?></td><?php } ?>
                                    <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 43 && $value['UserTableOrder'][0]['visible'] == 1) { ?><td><?php echo $dataArray[$x][6]['pSugerido']; ?></td><?php } ?>
                                    <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 44 && $value['UserTableOrder'][0]['visible'] == 1) { ?><td><?php echo $dataArray[$x][7]['pHoy']; ?></td><?php } ?>
                                    <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 45 && $value['UserTableOrder'][0]['visible'] == 1) { ?><td><?php echo $dataArray[$x][8]['pSemanal']; ?></td><?php } ?>
                                    <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 46 && $value['UserTableOrder'][0]['visible'] == 1) { ?><td><?php echo $dataArray[$x][9]['diferencia']; ?></td><?php } ?>
                                    <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 47 && $value['UserTableOrder'][0]['visible'] == 1) { ?><td><?php echo $dataArray[$x][10]['pSemana1']; ?></td><?php } ?>
                                    <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 48 && $value['UserTableOrder'][0]['visible'] == 1) { ?><td><?php echo $dataArray[$x][11]['promedioS']; ?></td><?php } ?>
                                    <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 49 && $value['UserTableOrder'][0]['visible'] == 1) { ?><td><?php echo $dataArray[$x][12]['maximo']; ?></td><?php } ?>
                                    <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 50 && $value['UserTableOrder'][0]['visible'] == 1) { ?><td><?php echo $dataArray[$x][12]['minimo']; ?></td><?php } ?>
                                    <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 51 && $value['UserTableOrder'][0]['visible'] == 1) { ?><td><?php echo $dataArray[$x][12]['desviacion']; ?></td><?php } ?>
                                    <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 52 && $value['UserTableOrder'][0]['visible'] == 1) { ?><td><?php echo $dataArray[$x][12]['competidores']; ?></td><?php } ?>
                                <?php }
                                ?>
                            </tr>
                            <?php
                        }
                        ?>

                    </tbody>
                </table>

            <?php } else { ?>  

                <table class="table table-bordered dataTable dataTable-scroll-x">
                    <thead>
                        <tr>
                            <th>Producto</th>
                            <th>Precio</th>
                            <th>Código Proveedor</th>
                            <th>Categoría</th>
                            <th>Marca</th>
                            <th>Únidades</th>
                            <th>Precio Sugerido</th>
                            <th>Precio Hoy</th>
                            <th>Precio Semanal</th>
                            <th>Diferencia</th>
                            <th>Precio Semana 1</th>
                            <th>Promedio Semanal</th>
                            <th>Máximo</th>
                            <th>Mínimo</th>
                            <th>Desviación</th>
                            <th>Competidores</th>
                        </tr>
                    </thead>
                    <tbody>

                        <?php foreach ($staff as $value) { ?>

                            <tr>
                                <td><?php echo $value['name']; ?></td>
                                <td><?php echo $value['name']; ?></td>
                                <td><?php echo $value['name']; ?></td>
                                <td><?php echo $value['name']; ?></td>
                                <td><?php echo $value['name']; ?></td>
                                <td><?php echo $value['name']; ?></td>
                                <td><?php echo $value['name']; ?></td>
                                <td><?php echo $value['name']; ?></td>
                                <td><?php echo $value['name']; ?></td>
                                <td><?php echo $value['name']; ?></td>
                                <td><?php echo $value['name']; ?></td>
                                <td><?php echo $value['name']; ?></td>
                                <td><?php echo $value['name']; ?></td>
                                <td><?php echo $value['name']; ?></td>
                                <td><?php echo $value['name']; ?></td>
                                <td><?php echo $value['name']; ?></td>
                            </tr>
                        <?php } ?>

                    </tbody>
                </table>


            <?php } ?>
        </div>
</div>
        </div>
    </div>
</div>